<template>
    <el-table id="test2" :max-height="tableHeight" :data="tableData" :header-cell-style="headerStyle" :cell-style="cellStyle" border style="width: 100%; background-color: #daecf8">
<!--      <el-table-column prop="productSeries" label="产品系列" width="180"/>-->
      <el-table-column prop="offeringName" label="关联Offering" width="280"/>
      <el-table-column prop="documentNumber" label="文档编号" width="220" />
      <el-table-column prop="documentName" label="文档名称" min-width="320"/>
      <el-table-column prop="documentType" label="文档类型" width="220" />
      <el-table-column prop="state" label="状态" width="190"/>
<!--      <el-table-column prop="version" label="版本" />-->
    </el-table>
  <Loading :loading="loading" absolute="true" :tip="loadingText"/>
</template>
<script lang="ts">
import * as API from '@/api/pbi/offering';
import {endLoading, getHeaderStyle, getTableCellStyle, loading, startLoading} from "@/utils";
import Loading from "@/components/Loading/src/Loading.vue";
export default {
  name: 'OfferingDocumentList',
  components: {Loading},
  props: [],
  data() {
    return {
      loading: false,
      loadingText: '数据正在加载中...',
      headerStyle: getHeaderStyle(),
      cellStyle: getTableCellStyle(),
      tableData : [],
      fwwfw : [
        {
          "documentNumber": "PBIDoc-00000001",
          "documentName": "低压变频器",
          "productSeries": "DA180系列",
          "offeringName": "DA180系列380V1.5～2kW",
          "state": "已发布",
          "version": "A"
        },
        {
          "documentNumber": "PBIDoc-00000001",
          "documentName": "低压变频器",
          "productSeries": "DA180系列",
          "offeringName": "DA180系列380V1.5～2kW",
          "state": "已发布",
          "version": "A"
        },
        {
          "documentNumber": "PBIDoc-00000001",
          "documentName": "低压变频器",
          "productSeries": "DA180系列",
          "offeringName": "DA180系列380V1.5～2kW",
          "state": "已发布",
          "version": "A"
        }
      ]
    };
  },
  computed: {
    tableHeight(){
      let size = window.innerHeight - 220;
      console.log("scroll高度");
      console.log(size);
      return size;
    }
  },
  created() {
    // this.findTableData()
  },
  methods: {
    async findTableData(pbiNumber) {
      this.tableData = [];
      this.loading = true
      try {
        const res = await API.getOfferingDocument({pbinumber: pbiNumber});
        if (res && res.success === 'true') {
          this.tableData = JSON.parse(res.data)
        }
      } catch (e) {
        console.log(e)
      } finally {
        this.loading = false
      }
    }
  }
};
</script>



